package testAndSomeTries.motionDetection;

/**
 * 
 * Class of a Pixel represented in RGB format
 * @author HINB
 *
 */
public class Pixel
{
	private static final long serialVersionUID = 1;
	
	/* *********************************************************
	 * Attributes
	 * ******************************************************** */
	/**
	 * Value of the red component of the Pixel
	 */
	private int _red;
	
	/**
	 * Value of the green component of the Pixel
	 */
	private int _green;
	
	/**
	 * Value of the blue component of the Pixel
	 */
	private int _blue;
	
	
	/* *********************************************************
	 * Constructor(s)
	 * ********************************************************* */
	/**
	 * Create a black Pixel
	 */
	public Pixel()
	{
		_red = 0;
		_green = 0;
		_blue = 0;
	}
	
	
	/**
	 * Create a Pixel with the specified color
	 * @param red red component of the Pixel
	 * @param green green component of the Pixel
	 * @param blue blue component of the Pixel
	 */
	public Pixel(int red, int green, int blue)
	{
		_red = red;
		_green = green;
		_blue = blue;
	}
	
	
	/**
	 * Create a gray Pixel with the specified color
	 * @param gray gray value of the Pixel
	 */
	public Pixel(int gray)
	{
		_red = gray;
		_green = gray;
		_blue = gray;
	}
	
	/* *********************************************************
	 * Instance Methods
	 * *********************************************************
	 */
	/**
	 * Set the red component of the Pixel
	 * @param red red component of the Pixel
	 */
	public void setRed(int red)
	{
		_red = red;
	}
	
	
	/**
	 * Set the green component of the Pixel
	 * @param green green component of the Pixel
	 */
	public void setGreen(int green)
	{
		_green = green;
	}
	
	
	/**
	 * Set the blue component of the Pixel
	 * @param blue blue component of the Pixel
	 */
	public void setBlue(int blue)
	{
		_blue = blue;
	}
	
	
	/**
	 * Set the gray color of the Pixel
	 * @param gray gray value of the Pixel
	 */
	public void setGray(int gray)
	{
		_red = gray;
		_green = gray;
		_blue = gray;
	}
	
	
	/**
	 * Set the color of the Pixel
	 * @param red red component of the Pixel
	 * @param green green component of the Pixel
	 * @param blue blue component of the Pixel
	 */
	public void setAll(int red, int green, int blue)
	{
		_red = red;
		_green = green;
		_blue = blue;
	}
	
	
	/**
	 * Get the red color of the Pixel
	 * @return the red component of the Pixel
	 */
	public int getRed()
	{
		return _red;
	}
	
	
	/**
	 * Get the green color of the Pixel
	 * @return the green component of the Pixel
	 */
	public int getGreen()
	{
		return _green;
	}
	
	
	/**
	 * Get the blue color of the Pixel
	 * @return the blue component of the Pixel
	 */
	public int getBlue()
	{
		return _blue;
	}
	
	
	/**
	 * Get the gray value of the Pixel
	 * @return the gray value of the Pixel
	 */
	public int getGray()
	{
		return _red;
	}
}
